﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RuleOfReady.Core.DomainModels.Sets;
using RuleOfReady.Core.DomainModels.Tiles;

namespace RuleOfReady.Core.Test.DomainModelTest
{
    [TestClass]
    public class SetTest
    {
        [TestMethod]
        public void TestSetEquality()
        {
            var bam2 = new MahjongSuitTile(MahjongSuitType.Bamboo, 2);
            var dot3 = new MahjongSuitTile(MahjongSuitType.Dot, 3);
            var bam2Pair1 = new MahjongPair(bam2);
            var bam2Pair2 = new MahjongPair(bam2);
            var dot3Pair = new MahjongPair(dot3);

            Assert.IsTrue(bam2Pair1 == bam2Pair2);
            Assert.IsFalse(bam2Pair1 == dot3Pair);


            var char7 = new MahjongSuitTile(MahjongSuitType.Character, 7);
            var char8 = new MahjongSuitTile(MahjongSuitType.Character, 8);
            var char9 = new MahjongSuitTile(MahjongSuitType.Character, 9);

            var seq = new MahjongSequence(new[] { char7, char8, char9 });

            Assert.IsFalse(bam2Pair1 == seq);

            Assert.IsTrue(bam2Pair1.GetHashCode() == bam2Pair2.GetHashCode());
        }

    }
}
